﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Nhom14_HTTTHD_BuyMe
{
    public partial class sell_domain : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["login"] != "1")
                Response.Redirect("login.aspx?url=sell-domain.aspx");
        }

        protected void Info_Submit_Click(object sender, EventArgs e)
        {
            using (websitebrokenEntities context = new websitebrokenEntities())
            {                               
                //public int SellDomain(int account, string siteURL, string description, string pageview, string price, int category)
                //public int Sell(int id_account, string SiteURL, string Description, string price, int id_category, string PageView, int type = 1, int SiteStatus = 0, string SiteName = null, string Visitor = null, string Income = null, string Cost = null, string Disk = null, String Bandwidth = null, string member = null)
       
                int par1 = Convert.ToInt32(Session["user"]);
                string par2 = Info_SiteURL.Text;
                string par3 = Info_Description.InnerText;
                string par4 = Info_Pageview.Text;
                string par5 = Info_Price.Text;
                int par6 = Convert.ToInt32(Info_Category.SelectedValue);

                string address = "http://localhost:49744/WebService1.asmx";
                string function = "Sell";
//public int Sell(int id_account(1), string SiteURL(2), string Description(3), string price(4), int id_category(5), string PageView(6), int type(7), 
//int SiteStatus(8), string SiteName(9), string Visitor(10), string Income(11), string Cost(12), string Disk(13), String Bandwidth(14), string member(15))
                int res = (int)WebserviceInvoker.WSInvoker.CallWebService(address, "WebService1", function, new object[] { par1, par2, par3, par4, par5, par6, 1, null, null, null, null, null, null, null, null });

                if (res != 0)
                {
                    string url_re = "special-listing.aspx?url=" + Info_SiteURL.Text + "&id=" + res.ToString() + "&type=2";
                    Response.Redirect(url_re);
                }

            }
        }
    }
}